﻿<div class="blogSidebar">
    <h2>Recent Posts</h2>
    <ul>
    @if ((this.ViewBag.RecentPosts as List<CMS.BL.Entity.tbl_Content>).Count() > 0)
    {
        foreach (var post in this.ViewBag.RecentPosts as List<CMS.BL.Entity.tbl_Content>)
        {
        <li><a href="@String.Format("/{0}/{1}", ViewBag.BlogUrl, post.tbl_SiteMap.SM_URL.Trim('/'))">@post.C_Title</a></li>
        }
    }
    else
    {
        <li>No Posts Exists</li>
    }
    </ul>
    <h2>Categories</h2>
    <ul>
    @if ((this.ViewBag.Categories as List<CMS.BL.Entity.tbl_Categories>).Count > 0)
    {
        foreach (var category in this.ViewBag.Categories as List<CMS.BL.Entity.tbl_Categories>)
        {
        <li><a href="@(String.Format("/{0}/{1}/{2}", ViewBag.BlogUrl, CMS.UI.SettingsManager.Blog.CategoryUrl.Trim('/'), category.CA_URL))">@category.CA_Title</a></li>
        }
        
    }
    else
    {
        <li>No Categories Exists</li>
    }
    </ul>
    <h2>Archives</h2>
    <ul>
    @if ((this.ViewBag.Archive as List<DateTime>).Count > 0)
    {
        foreach (var date in this.ViewBag.Archive as List<DateTime>)
        {
        <li><a href="@(String.Format("/{0}/{1}/{2}", ViewBag.BlogUrl, date.Year, date.Month))">@date.ToString("MMMM yyyy")</a></li>
        }
    }
    else
    {
        <li>No Archives Exists</li>
    }
    </ul>
    <h2>RSS Feed</h2>
    <a class="rssLink" href="/@ViewBag.BlogUrl/feed">RSS Feed</a>
</div>